import { SET_COOKIE, SET_TOKEN, SET_USER } from "../actionTypes"
const initState = {
    profile: {},
    token: "",
    cookie: ""
}

export const user = (state = initState, action) => {
    let { type, payload } = action
    switch (type) {
        case SET_COOKIE:
            return { ...state, cookie: payload };
        case SET_USER:
            return { ...state, profile: payload };
        case SET_TOKEN:
            return { ...state, token: payload };
        default:
            return state;
    }
}